package com.example.hj.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.hj.entity.Student;
import com.example.hj.mapper.StudentMapper;
import com.example.hj.service.IStudentService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author huangjian
 * @since 2019-05-30
 */
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements IStudentService {

    @Override
    @Cacheable(value = "getStudentList")
    public List<Student> getStudentList(){
        System.out.println("getStudentList+++++++++++++");
        return this.list();
    }

    @Override
    @Cacheable(value = "getStudent")
    public Student getStudent(){
        System.out.println("getStudent-----------");
        Student s=new Student();
        s.setId(111);
        s.setName("测试缓存");
        return s;
    }

    @Override
    public List<Student> selectStudentByClass(){
        return baseMapper.selectStudentByClass();
    }
}
